package edu.ubbcs.rs.backend.service.filter;

import edu.ubbcs.rs.backend.model.room.Room;
import java.util.Iterator;
import java.util.List;

/**
 * @author Merli Andras-Bertalan
 * @version 1.0
 * @created 09-jan.-2015 15:37:44
 */
public class HourFilter implements Filter<Integer> {

    private Integer filterValue;

    public HourFilter() {
    }

    @Override
    public void filter(List<Room> rooms) {
                System.out.println("HourFilter: " + filterValue);
        if (filterValue != null) {
            Iterator<Room> i = rooms.iterator();
            while (i.hasNext()) {
                Room room = i.next();
                if (!room.getHour().equals(filterValue)) {
                    i.remove();
                }
            }
        }
    }

    @Override
    public void setFilterValue(Integer filter) {
        this.filterValue = filter;
    }

    @Override
    public Integer getFilterValue() {
        return filterValue;
    }
}
